#!/usr/bin/perl

use Test;
BEGIN { plan tests => 2 }

$basedir = $0;
$basedir =~ s|(.*)/[^/]*|$1|;

# Remove any leftover test file from prior failed runs.
system("rm -rf $basedir/test_file");

# Create a test file with the test_stat_file_t type for use in the tests.
system("touch $basedir/test_file");
system("chcon -t test_stat_file_t $basedir/test_file");

# Verify that test_stat_t can get attributes on the file.
$result = system("runcon -t test_stat_t -- ls -l $basedir/test_file 2>&1");
ok( $result, 0 );

# Verify that test_nostat_t cannot get attributes on the file.
$result = system("runcon -t test_nostat_t -- ls -l $basedir/test_file 2>&1");
ok($result);

# Cleanup.
system("rm -rf $basedir/test_file");

